#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<stdlib.h>

  float ebserror(float x1,float x2)
{
   float errorebs;
   errorebs = fabs(x1-x2);
   return errorebs;
} 





float x1(float a,float b)
{
   float x,x1;
   float abserror; 
   float send; 
   float fa,fx,fax;
   float samakarn,samakarn1,samakarn2;
   int i;   
do
{ 
   x=(a+b)/2; 
   printf("x:%.3f\n",x);
   samakarn = (pow(x,5)+pow(x,3)+pow(x,2)-1);
   printf("fx:%.3f\n",samakarn);
   samakarn1 = (pow(a,5)+pow(a,3)+pow(a,2)-1);
   printf("fa:%.3f\n",samakarn1);
   fax=samakarn1*samakarn;
   printf("fax:%.3f\n",fax);
   printf("error:%.3f\n\n\n",send);
   if(fax>0)
   {
     a=x;
     b=b;
   }
   else if(fax<0)
   {
     a=a;
     b=x;
   }
   
   x1=(a+b)/2; 
   //printf("\nx:%.3f\n",x1);
   send = ebserror(x1,x);
   abserror = fabs(x1-x);
   //printf("error:%.3f\n\n........",send);
 }while(send>0.1);
   return x1;
   
} 



int main()
{
  float a1=0,b1=1;
  float send;
  int i;

  send = x1(a1,b1);
  printf("\nx:%.3f",send);
  getch();
  return 0;

}
